package Operations;

import Book.BookList;
import java.util.Scanner;

public class ReturnOperation implements Operation{

    @Override
    public void operation(BookList bookList) {

        Scanner scanner = new Scanner(System.in);

        System.out.println("归还图书");

        System.out.println("输入要归还书的书名");
        String name = scanner.nextLine();

        for (int i = 0; i < bookList.getUsedSize(); i++) {
            if (name.equals(bookList.getBooks()[i].getName())) {
                bookList.getBooks()[i].setBorrowed(false);
                System.out.println("归还成功");
                System.out.println(bookList.getBooks()[i].toString());
            }
        }
    }
}
